package com.loadmore.common.schedule

import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Route
import com.loadmore.common.R
import com.loadmore.common.base.BaseActivity
import com.loadmore.common.model.Schedule
import com.loadmore.common.router.Router
import com.loadmore.common.router.RouterPath
import com.qmuiteam.qmui.widget.dialog.QMUIDialog


@Route(path = RouterPath.Alarm)
class AlarmActivity : BaseActivity() {

    private val mCurrentDialogStyle = com.qmuiteam.qmui.R.style.QMUI_Dialog
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_alarm)
        hideActionBar()
        showMessagePositiveDialog()

    }

    private fun showMessagePositiveDialog() {
        val schedule: Schedule? = intent.extras?.getSerializable("data") as Schedule?
        if (schedule != null) {
            val dialog = QMUIDialog.MessageDialogBuilder(this)
                    .setMessage(schedule.brief)
                    .addAction("取消") { dialog, index ->
                        dialog.dismiss()
                    }
                    .addAction("查看") { dialog, index ->
                        dialog.dismiss()
                        Router.go(RouterPath.ScheduleDetail, schedule)
                    }
                    .create(mCurrentDialogStyle)
            dialog.setOnDismissListener {
                finish()
            }
            dialog.show()

        }

    }
}
